<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <meta name="twitter:site" content="@metroui">
    <meta name="twitter:creator" content="@pimenov_sergey">
    <meta name="twitter:card" content="summary">
    <meta name="twitter:title" content="Metro 4 Components Library">
    <meta name="twitter:description" content="Metro 4 is an open source toolkit for developing with HTML, CSS, and JS. Quickly prototype your ideas or build your entire app with responsive grid system, extensive prebuilt components, and powerful plugins  .">
    <meta name="twitter:image" content="https://metroui.org.ua/images/m4-logo-social.png">

    <meta property="og:url" content="https://metroui.org.ua/v4/index.html">
    <meta property="og:title" content="Metro 4 Components Library">
    <meta property="og:description" content="Metro 4 is an open source toolkit for developing with HTML, CSS, and JS. Quickly prototype your ideas or build your entire app with responsive grid system, extensive prebuilt components, and powerful plugins  .">
    <meta property="og:type" content="website">
    <meta property="og:image" content="https://metroui.org.ua/images/m4-logo-social.png">
    <meta property="og:image:secure_url" content="https://metroui.org.ua/images/m4-logo-social.png">
    <meta property="og:image:type" content="image/png">
    <meta property="og:image:width" content="968">
    <meta property="og:image:height" content="504">

    <meta name="author" content="Sergey Pimenov">
    <meta name="description" content="The most popular HTML, CSS, and JS library in Metro style.">
    <meta name="keywords" content="HTML, CSS, JS, Metro, CSS3, Javascript, HTML5, UI, Library, Web, Development, Framework">

    <link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon">
    <link rel="icon" href="../../favicon.ico" type="image/x-icon">

    <link href="../../metro/css/metro-all.css?ver=@@b-version" rel="stylesheet">
    <link href="../../css/site.css" rel="stylesheet">

    <title>Color schemes - Metro 4 :: Popular HTML, CSS and JS library</title>

    <style>
        .cell {
            color: white;
        }
    </style>

</head>
<body>
    <div class="container">
        <h1>Metro 4 Color generator</h1>
        <div class="bg-light p-4">
            <input data-role="input" id="current-color" data-prepend="Color: #" placeholder="Enter your color hex value or color name">
        </div>

        <h3><code id="base-color" class="w-100"></code></h3>
        <div id="scheme-container"></div>

    </div>

    <script src="../../metro/js/metro.js"></script>
    <!-- ads-script -->

    <script>
        $(function(){
            'use strict';
            var cm = Metro.colors;
            var schemes = ['analog', 'split', 'comp', 'triad', 'square', 'tetra', 'double', 'mono'];
            var colors = [];
            var container = $("#scheme-container").html("");
            var input = $("#current-color");

            input.on(Metro.events.inputchange, function(){
                var target;
                var color = this.value[0] === "#" ? "" : "#"+this.value;

                if (this.value.length < 6) {
                    return ;
                }

                if (cm.isHEX(color) === false) {
                    return ;
                }

                container.html("");

                $("#base-color").html("Base color is: " + color);

                $.each(schemes, function(){
                    var scheme_name = this;

                    target = $("<div>").addClass("row flex-align-center m-0").appendTo(container);

                    colors = cm.createScheme(color, scheme_name, 'hex', {
                        algorithm: 3
                    });

                    $("<h5>").addClass("w-100 text-light pl-4 flex-no-shrink").html(scheme_name).appendTo(target);
                    $.each(colors, function(key, bg_color){
                        $("<div>").addClass("p-4 cell text-center mb-2").html(bg_color).attr("style", "background-color:"+ bg_color).appendTo(target);
                    })
                });

                target = $("<div>").addClass("row flex-align-center m-0").appendTo(container);

                var lightenColor = cm.lighten(color);
                $("<h5>").addClass("w-100 text-light pl-4 flex-no-shrink").html("lighten &amp; darken on 10%").appendTo(target);
                $("<div>").addClass("p-4 cell text-center mb-2").html(lightenColor).attr("style", "background-color:"+ lightenColor).appendTo(target);
                $("<div>").addClass("p-4 cell text-center mb-2").html(color).attr("style", "background-color:"+ color).appendTo(target);
                $("<div>").addClass("p-4 cell text-center mb-2").html(cm.darken(color)).attr("style", "background-color:"+ cm.darken(color)).appendTo(target);

                target = $("<div>").addClass("row flex-align-center m-0").appendTo(container);
                $("<h5>").addClass("w-100 text-light pl-4 flex-no-shrink").html("Grayscale").appendTo(target);
                $("<div>").addClass("p-4 cell text-center mb-2").html(color).attr("style", "background-color:"+ color).appendTo(target);
                $("<div>").addClass("p-4 cell text-center mb-2").html(cm.grayscale(color)).attr("style", "background-color:"+ cm.grayscale(color)).appendTo(target);

            });

            input.val("cc0000").trigger("change");

            // var col = "#cc0000";
            // var hsv = cm.hex2hsv(col);
            // var hsl = cm.hsv2hsl(hsv);
            // console.log(col);
            // console.log(hsv);
            // console.log(hsl);
            // console.log(cm.hsl2hsv(cm.hsv2hsl(hsv)));
        })
    </script>

</body>
</html>